<div id="wrapper">

    <form action="" class="login_form" method="post" onsubmit="beforesubmit" target="ifr_login">
		<fieldset>
			<div class="title_wrapper">
				<h1>Please Log in</h1>
				<a href="#">Forgot Password?</a>
			</div>
			<div class="inputs">
				<div class="inputs_inner">
					<label>
						<strong>Username:</strong>
						<span class="input"><input name="txtu" id="txtu" type="text" /></span>
					</label>
					<label>
						<strong>Password:</strong>
						<span class="input"><input name="txtp" id="txtp" type="password" /></span>
					</label>
					<span class="button first_btn"><span><span>Log in</span></span><input name="btnlogin" id="btnlogin" type="submit" /></span>
				</div>
				
			</div>
			<div class="reminder">
				<input name="" type="checkbox" value="" /> Remember me on this computer
			</div>
			
			<ul class="system_messages" style="display:none;">
				<li id="errmsg" class="red"></li>
			</ul>
			
			
		</fieldset>
	</form>
        <iframe id="ifr_login" name="ifr_login" style="width:	0px;height:	0px;"></iframe>
	<script>
            function beforesubmit(){
                login();
                return false;
            }
            function login(){
                var surl="../Controller/Navigation.php";
                var sdata={
                        "controller":"SYSController",
                        "action":"login",
                        "u": Trim($("#txtu").val()),
                        "p": Trim($("#txtp").val())

                };
                jQuery.ajax({
                        type:"POST", 
                        data:sdata, 
                        dataType:"text", 
                        url:surl, 
                        success: function (data){ 
                                $("#errmsg").html(data);
                                $(".system_messages").show();
                        },
                        error: function (xhr, ajaxOptions, thrownError){
                                $("#errmsg").html("<li><b>Status</b>:"+xhr.status+"<br/><b>ThrownError</b>:"+thrownError+"</li>");
                                $(".system_messages").show();
                        }
                });
}
		$("#btnlogin").click(
			function(){
				login();		
			}
		);
	</script>
</div>

